package com.kankan.demo;

import com.alibaba.fastjson.JSONObject;
import com.kankan.utils.HttpClientTools;
import org.apache.commons.lang3.RandomUtils;

public class TestSms {

    static  String url="https://open.ucpaas.com/ol/sms/sendsms";

    static String appId="f5fa1cc2d9c8470a9764ceb3d28b0d52";

   static String accountSid="6a5f9646f9f37938411e8af4dd051b56";

    static String authToken="22ceb87a7**********ca233c89852e8745";

    static  String templateId="599242";

    public static void main(String[] args) {

        JSONObject jsonObject=new JSONObject();
        jsonObject.put("sid",accountSid);
        jsonObject.put("token",authToken);
        jsonObject.put("appid",appId);
        jsonObject.put("templateid",templateId);
        jsonObject.put("mobile","************");
        jsonObject.put("param", RandomUtils.nextInt(100000, 999999));

        JSONObject res = HttpClientTools.httpPost(url, jsonObject);

        String code = (String) res.get("code");
        String msg = (String) res.get("msg");
        System.out.println(msg);
        if ("0".equals(code)){
            System.out.println("发送成功！！！！！！");
        }
    }
}
